let newArr = [
    { id: 1, name: "张三", age: 20, arr: 3 },
    { id: 2, name: "李四", age: 8, arr: 2 },
    { id: 3, name: "张三", age: 18, arr: 4 },
];
let newItem = newArr.map((item) => {
    return (allage = item.age ? item.age : 0);
});

function sum(arr) {
    var s = 0;

    arr.forEach(function(val, idx, arr) {
        s += val;
    }, 0);

    return s;
}
let numarr = 23;
// console.log("累加数据", sum(newItem));
let newall = numarr + sum(newItem);
console.log("业务比例总和", newall);
// 找到数组中的item是否存在arr=1 与arr=2
// let dizhi = newArr.findIndex((item) => {
//     item.arr == 1 && item.arr == 2;
// });
// console.log("找到的参数", dizhi1);
function findyingye(val) {
    return val.arr == 1;
}

console.log("查看是否存在满足条件的元素", newArr.findIndex(findyingye));